﻿using log4net;
using System;
using System.Collections.Generic;
using System.Collections.Specialized;
using System.Linq;
using System.Text;
using Timesheet.Data.Infrastructure;
using Timesheet.Data.Repository;
using Timesheet.Domain;

namespace Timesheet.Service
{
    public class GroupsService : IGroupsService
    {
        private readonly IGroupsRepository _Repository;
        private readonly IUnitOfWork _UnitOfWork;
        public ILog Logger { get; private set; }

        public GroupsService(IGroupsRepository GroupsRepository,IUnitOfWork unitOfWork)
        {
            this._Repository = GroupsRepository;
            this._UnitOfWork = unitOfWork;
        }


        #region IGroupsService Members

        public IList<Groups> GetGroups()
        {
            return this._Repository.GetAll().OrderBy(p=>p.Name).ToList();
        }       
        public Groups GetByID(Int64 id)
        {
            return this._Repository.GetById(id);
        }

        public void Add(Groups entity)
        {
            this._Repository.Add(entity);
        }

        public void Update(Groups entity)
        {
            this._Repository.Update(entity);
        }

        public void Delete(Groups entity)
        {
            this._Repository.Delete(entity);
        }             
        #endregion       
    }
}
